package com.yswl.yeeduo.ui.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.DisplayImageOptions;
import com.nostra13.universalimageloader.core.ImageLoader;
import com.yswl.yeeduo.R;
import com.yswl.yeeduo.ui.bean.RankingBean.ActiveListItemBean;
import com.yswl.yeeduo.ui.utils.ImageUtil;
import com.yswl.yeeduo.view.listview.BaseListViewAdapter;

public class RankingListAdapter extends BaseListViewAdapter<ActiveListItemBean> {

	private LayoutInflater mInflater;
	protected ImageLoader imageLoader;
	protected DisplayImageOptions mOptions;

	public RankingListAdapter(Context context) {
		super(context);
		mInflater = LayoutInflater.from(context);
		mOptions = ImageUtil.getDefaultOptions();
		imageLoader = ImageLoader.getInstance();
	}

	@Override
	public View getView(int position, View convertView, ViewGroup parent) {
		ViewHolder viewHolder = null;
		if (convertView == null) {
			viewHolder = new ViewHolder();
			convertView = mInflater.inflate(R.layout.ranking_list_item, null);
			viewHolder.name = (TextView) convertView.findViewById(R.id.name);
			viewHolder.count = (TextView) convertView.findViewById(R.id.count);

			convertView.setTag(viewHolder);
		} else {
			viewHolder = (ViewHolder) convertView.getTag();
		}
		ActiveListItemBean beanData = getItem(position);
		viewHolder.name.setText(beanData.title);
		viewHolder.count.setText(beanData.rank);
		
		return convertView;
	}

	private static class ViewHolder {
		public TextView name;
		public TextView count;
	}


}
